package com.labreeze.spring.resource;

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.Reader;

import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.FileSystemResource;
import org.springframework.core.io.Resource;


public class TestResource {
	
	public static void main(String[] args) throws Exception {
		
		Resource res1=new ClassPathResource("test.xml");
		if(res1.exists()){
			System.out.println(res1.getFilename());
			
			BufferedReader reader =new BufferedReader(new FileReader(res1.getFile()));
			String line=reader.readLine();
			while(line!=null){
				System.out.println(line);
				line=reader.readLine();
			}
			if(reader!=null){
				reader.close();
			}
		}
		
		
		Resource res2=new FileSystemResource("D:\\Eclipse\\spring\\spring-ioc2\\src\\main\\resources\\test.xml");
		if(res2.exists()){
			System.out.println(res2.getFilename());
		}
		
		
	}

}
